import system from '@mxpio/system';
import flow from '@mxpio/flow';
import dbconsole from '@mxpio/dbconsole';
import demo from '@mxpio/demo';
import technology from '@mxpio/technology';
import inventory from '@mxpio/inventory';
import sales from '@mxpio/sales';
import purchase from '@mxpio/purchase';
import common from '@mxpio/bizcommon';
import workshop from '@mxpio/workshop';

const modules = import.meta.glob('./modules/**/*.ts', { eager: true });

const modulesComponents = {};

Object.keys(modules).forEach((key) => {
  const mod = (modules as Recordable)[key].default || {};
  Object.assign(modulesComponents, mod);
});
const LAYOUT = () => Promise.resolve(import('@mxpio/layouts/src/default/index.vue'));

export const pages = {
  LAYOUT,
  ...system,
  ...flow,
  ...dbconsole,
  ...demo,
  ...technology,
  ...inventory,
  ...sales,
  ...purchase,
  ...modulesComponents,
  ...common,
  ...workshop,
};
export default pages;
